package com.xiaoniu.lib_keleim.pojo.vos;


import com.xiaoniu.lib_keleim.pojo.dos.ConversationEntity;

public class MessageConversationVO extends BaseBean{
    public Long lastMessageId;
    //目标
    public long targetId;
    //发送人用户ID
    public long userId;
    //未读消息数量
    public int unReadCount;

    public Long updateTime;

    public Long createTime;

    public BaseMessage messageChatVO;


    public long getRealTargetId() {
        if (UserInfoVO.getSingleton().getCustomerId()==userId) {
            return targetId;
        }
        return userId;
    }


    public ConversationEntity toMessageConversationEntity() {
        ConversationEntity conversationEntity = new ConversationEntity();
        conversationEntity.lastMessageId = lastMessageId;
        conversationEntity.targetId = targetId;
        conversationEntity.userId = userId;
        conversationEntity.updateTime = updateTime;
        conversationEntity.createTime = createTime;
        conversationEntity.generateLocalId();

        //conversationEntity.messageChatDO = messageChatVO.toMessageEntity();
        return conversationEntity;
    }
}
